package com.tuliyou.controller;

import com.tuliyou.common.util.Result;
import com.tuliyou.dto.PageInfo;
import com.tuliyou.service.UniMajorEnrollmentService;
import com.tuliyou.vo.UniMajorEnrollmentVO;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/uni-major-enrollments")
public class UniMajorEnrollmentController {

    @Resource
    private UniMajorEnrollmentService uniMajorEnrollmentService;

    @GetMapping
    public Result<PageInfo<UniMajorEnrollmentVO>> getUniMajorEnrollments(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size,
            @RequestParam String universityCode, // 招生大学代码
            @RequestParam(defaultValue = "2025") Integer enrollYear // 招生大学年份
    ) {
        return uniMajorEnrollmentService.getUniMajorEnrollments(page,size,universityCode,enrollYear);
    }

    @GetMapping("/{id}")
    public Result<UniMajorEnrollmentVO> getUniMajorEnrollmentDetail(@PathVariable("id") Long id){
        return uniMajorEnrollmentService.getUniMajorEnrollmentDetail(id);
    }

}
